package com.minova.demo.mapper;

import com.minova.demo.entity.TzProdComm;

import java.util.List;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;

/**
 * <p>
 * 商品评论 Mapper 接口
 * </p>
 *
 * @author linrongji
 * @since 2019-12-23
 */
public interface TzProdCommMapper extends BaseMapper<TzProdComm> {

	@Select("SELECT ((SELECT COUNT(1) FROM tz_prod_comm WHERE prod_id =#{prodid} )  / (SELECT COUNT(1) FROM tz_prod_comm WHERE prod_id = #{prodid} AND evaluate=1))")
	public int getGoodRate(@Param("prodid")Integer prodid);
	
	@Select("SELECT * FROM tz_prod_comm WHERE prod_id =#{prodid} ")
	public List<TzProdComm> getListTzProdComm(@Param("prodid")Integer prodid);
}
